# -*- coding: utf-8 -*-
"""
openworship - Open Source Church Service Management
Copyright (c) 2008 Kevin Landers

Portions copyright (c) 2008 Raoul Snyman, Joshua Biagio, Michael Lucas and
Scott Guerrieri

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""

"""
This module contains the classes for the models.
"""

class BaseModel(object):
    """
    BaseModel provides a base model with a set of generic functions
    """
    @classmethod
    def populate(cls, **kwargs):
        """
        Creates an instance of a class and populates it, returning the instance
        """
        me = cls()
        keys = kwargs.keys()
        for key in keys:
            me.__setattr__(key, kwargs[key])
        return me

class Member(BaseModel):
    """
    Member model
    """
    def has_access(self, permission):
        """
        Determines if a member has access to a certain permission
        """
        for role in self.roles:
            for perm in role.permissions:
                if perm.name == permission:
                    return True
        return False

class Role(BaseModel):
    """
    Roles model
    """
    pass

class Permission(BaseModel):
    """
    Permission model
    """
    pass

class Church(BaseModel):
    """
    Church model
    """
    pass

class Song(BaseModel):
    """
    Song model
    """
    pass

class Author(BaseModel):
    """
    Authors model
    """
    pass

class Bible(BaseModel):
    """
    Bible model
    """
    pass

class Testament(BaseModel):
    """
    Testament model
    """
    pass

class Book(BaseModel):
    """
    Book model
    """
    pass

class Verse(BaseModel):
    """
    Verse model
    """
    pass

class BibleReference(BaseModel):
    """
    BibleReference model
    """
    pass

class Service(BaseModel):
    """
    Service model
    """
    pass

class WorshipGroup(BaseModel):
    """
    WorshipGroup model
    """
    pass

class Capacity(BaseModel):
    """
    Capacity model
    """
    pass

class Function(BaseModel):
    """
    Function model
    """
    pass

class WorshipGroupMember(BaseModel):
    """
    WorshipGroupMember model
    """
    pass

class ServiceMember(BaseModel):
    """
    ServiceMember model
    """
    pass

class Topic(BaseModel):
    """
    Topic model
    """
    pass

class File(BaseModel):
    """
    File model
    """
    pass

class Preacher(BaseModel):
    """
    Preacher model
    """
    pass
